package com.sunfield.baseframe.http;

import android.content.Context;

import com.sunfield.baseframe.view.LoadingDialog;

/**
 * Created by wangxl on 2016/10/29.
 */
public class BaseHttpClient {
    boolean isLock = false;
    Context context;
    LoadingDialog loadingDialog;

    public BaseHttpClient(Context context) {
        this.context = context;
        loadingDialog = new LoadingDialog(context);
    }

    protected HttpParams createHttpParams(String url, String methodName){
        HttpParams httpParams = new HttpParams(createUrl(url), this);

        httpParams.setClientClassName(getClass().getName());
        httpParams.setClientMethodName(methodName);

        return httpParams;
    }

    public final String createUrl(String url){
        return HttpHeader.getInstance().getHttpBaseUrl() + url;
    }

    public void dismiss(){
        loadingDialog.dismiss();
    }

    public void show(){
        loadingDialog.show();
    }
}
